package com.xjscrm.console.web.operatePlan;
import com.xjscrm.console.param.operatePlan.*;
import com.xjscrm.console.service.customer.operatePlan.FaqRepiyBatchService;
import com.xjscrm.console.service.customer.operatePlan.FaqReplyService;
import com.xjscrm.console.vo.EffectuateGroupVo;
import com.xjscrm.console.vo.FaqReplyDeviceVo;
import com.xjscrm.console.vo.FaqReplyVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "智能应答方案管理", tags = "智能应答方案管理")
@RestController
@RequestMapping(value = "/faqReply")
public class FaqReplyController {

    @Autowired
    private FaqReplyService faqReplyService;

    @Autowired
    private FaqRepiyBatchService faqRepiyBatchService;

    @ApiOperation(value = "新增智能应答方案", notes = "新增智能应答方案", response = Boolean.class)
    @PostMapping(value = "/addFaqReply")
    public Object addFaqReply(@RequestBody FaqReplyDto faqReplyDto)throws Exception{
        faqReplyService.addFaqReply(faqReplyDto);
        return true;
    }

    @ApiOperation(value = "修改智能应答方案名", notes = "修改智能应答方案名", response = Boolean.class)
    @PostMapping(value = "/updateFaqReplyName")
    public Object updateFaqReplyName(@RequestBody FaqReplyDto faqReplyDto)throws Exception{
        faqReplyService.updateFaqReplyName(faqReplyDto);
        return true;
    }

    @ApiOperation(value = "修改智能应答方案", notes = "修改智能应答方案", response = Boolean.class)
    @PostMapping(value = "/updateFaqReply")
    public Object updateFaqReply(@RequestBody FaqReplyDto faqReplyDto)throws Exception{
        faqReplyService.updateFaqReply(faqReplyDto);
        return true;
    }

    @ApiOperation(value = "查询智能应答方案列表", notes = "查询智能应答方案列表", response = FaqReplyVo.class)
    @PostMapping(value = "/getFaqReplyList")
    public Object getFaqReplyList(@RequestBody FaqReplyQuery faqReplyQuery)throws Exception{
        return faqReplyService.getFaqReplyList(faqReplyQuery);
    }

    @ApiOperation(value = "查询智能应答方案详情", notes = "查询智能应答方案详情", response = FaqReplyVo.class)
    @PostMapping(value = "/getFaqReplyDetail")
    public Object getFaqReplyDetail(@RequestBody FaqReplyDto faqReplyDto)throws Exception{
        return faqReplyService.getFaqReplyDetail(faqReplyDto);
    }


    @ApiOperation(value = "删除智能应答方案详情", notes = "删除智能应答方案详情", response = Boolean.class)
    @PostMapping(value = "/deleFaqReply")
    public Object deleFaqReply(@RequestBody FaqReplyDto faqReplyDto)throws Exception{
        faqReplyService.deleFaqReply(faqReplyDto);
        return true;
    }

    @ApiOperation(value = "查询智能应答方案应用列表", notes = "查询智能应答方案应用列表", response = FaqReplyDeviceVo.class)
    @PostMapping(value = "/getFaqReplyDeviceList")
    public Object getFaqReplyDeviceList(@RequestBody FaqReplyDeviceQuery faqReplyDeviceQuery)throws Exception{
        return faqReplyService.getFaqReplyDeviceList(faqReplyDeviceQuery);
    }


    @ApiOperation(value = "批量新增智能应答方案和机器人关系", notes = "批量新增智能应答方案和机器人关系", response = Boolean.class)
    @PostMapping(value = "/batchAddReplyDevice")
    public Object batchAddReplyDevice(@RequestBody BatchFaqReplyDto batchFaqReplyDto)throws Exception{
        faqRepiyBatchService.batchAddReplyDevice(batchFaqReplyDto);
        return true;
    }


    @ApiOperation(value = "批量删除智能应答方案应用", notes = "批量删除智能应答方案应用", response = Boolean.class)
    @PostMapping(value = "/batchdeleFaqReplyDevice")
    public Object batchdeleFaqReplyDevice(@RequestBody BatchFaqReplyDto batchFaqReplyDto)throws Exception{
         faqRepiyBatchService.batchdeleFaqReplyDevice(batchFaqReplyDto);
        return true;
    }

    @ApiOperation(value = "查询智能应答方案应用的机器人ID列表", notes = "查询智能应答方案应用的机器人ID列表", response = Long.class)
    @PostMapping(value = "/getUsedDeviceUniqueIds")
    public Object getUsedDeviceUniqueIds(@RequestBody FaqReplyDto faqReplyDto)throws Exception{
        return faqReplyService.getUsedDeviceUniqueIds(faqReplyDto);
    }


    @ApiOperation(value = "获取生效群", notes = "获取生效群", response = EffectuateGroupVo.class)
    @PostMapping("/getEffectuateGroup")
    public Object getEffectuateGroup(@RequestBody EffectuateGroupDto effectuateGroupDto)throws Exception{
        return faqReplyService.findAddFangetEffectuateGroupGroup(effectuateGroupDto);
    }
}
